<?php

// Init owncloud

require_once(OC_App::getAppPath('resumes') . "/lib/helper.php");

OCP\JSON::callCheck();
$companyid = 0;
if(!OC_User::isLoggedIn()) {
   $app = PFactory::getApplication(); 
   $companyid = $app->getUserState('resumeshare_companyid', 0); 
   if(!$companyid) {
      echo '您需要先登录'; 
      exit;
   }
} else {
   if (PFactory::isJobseekerUser()) {
      echo '您不是企业用户';
      exit();
   } else {
      $user = PFactory::getMasterUser();
      $companyid = $user->id;
   }
}

$app = PFactory::getApplication();
$resumedir = $app->getUserState('resumedir', null);
$showmorejob = JArrayHelper::getValue($resumedir, 'showmorejob', 0);

$jobpos = JRequest::getInt('jobpos', 0);

$searchUrl = JRequest::getString('searchurl', OCP\Util::linkToRoute('resumes_search'));
$jobList = PResumesHelper::getJobList($companyid);

$tmpl = new OCP\Template('resumes', 'part.resume.advancedsearch', '');
$tmpl->assign('jobList', $jobList);
$tmpl->assign('jobpos', $jobpos);
$tmpl->assign('showmorejob', $showmorejob);
$tmpl->assign('searchurl', $searchUrl);
$tmpl->printPage();
?>





